/*
 * @Author: wangtao
 * @Date: 2020-06-29 09:20:28
 * @LastEditors: kanglang
 * @LastEditTime: 2021-02-18 15:36:04
 * @Description: 发布货源
 */

import { fetchGet, fetchPost } from '../config';

/**
 * @description: 获取发布货源分类
 * @param {type} boolean
 * @return:  data: true
 */
export const fetchSupplyType = () => {
  return fetchGet('supply-api/api/v1/supply/pageSupplyType');
};

/**
 * @description: 获取所有车型
 * @param {type} boolean
 * @return:
 */
export const fetchTruckTypes = () => {
  return fetchGet('supply-api/api/v1/owner/getTruckTypes');
};

/**
 * @description: 获取所有车长
 * @param {type} boolean
 * @return:
 */
export const fetchTruckLengths = () => {
  return fetchGet('supply-api/api/v1/owner/getTruckLengths');
};

/**
 * @description: 获取所有备注配置
 * @param {type} boolean
 * @return:
 */
export const fetchRemarks = () => {
  return fetchGet('supply-api/api/v1/owner/getRemarks');
};

/**
 * @description: 获取货物所有分类
 * @param {type} boolean
 * @return:
 */
export const fetchSupplyTypes = () => {
  return fetchGet('supply-api/api/v1/owner/getSupplyTypes');
};

/**
 * @description: 获取所有包装方式
 * @param {type} boolean
 * @return:
 */
export const fetchPackagingTypes = (params) => {
  return fetchGet('supply-api/api/v1/owner/getPackagingTypes', params);
};

/**
 * @description: 发货
 * @param {type} boolean
 * @return:
 */
export const fetchPublishSupply = (params) => {
  return fetchPost('supply-api/api/v1/owner/publishSupply', params);
};

/**
 * @description: 货源详情
 * @param {type} boolean
 * @return:
 */
export const fetchSupplyDetails = (params) => {
  return fetchGet('supply-api/api/v1/owner/supplyDetails', params);
};

/**
 * @description: 所有货物 3.0
 * @param {type} boolean
 * @return:
 */
export const allGoods = (params) => {
  return fetchGet('supply-api/api/v1/supply/dict/allGoods', params);
};

/**
 * @description: 所有打包类型 3.0
 * @param {type} boolean
 * @return:
 */
export const allPackageType = (params) => {
  return fetchGet('supply-api/api/v1/supply/dict/allPackageType', params);
};
/**
 * @description: 打包类型 3.0
 * @param {type} boolean
 * @return:
 */
export const findPackageTypeByGoodsTypeId = (goodsTypeId) => {
  return fetchGet(`supply-api/api/v1/supply/dict/findPackageTypeByGoodsTypeId/${goodsTypeId}`);
};
/**
 * @description: 获取计量单位 3.0
 * @param {type} boolean
 * @return:
 */
export const fetchUnitList = (params) => {
  return fetchGet('supply-app-api/api/v1/supply/dict/unitList', params);
};
/**
 * @description: 获取所有用车类型 3.0
 * @param {type} boolean
 * @return:
 */
export const allTransportType = (params) => {
  return fetchGet('supply-api/api/v1/supply/dict/allTransportType', params);
};

/**
 * @description: 所有车型 3.0
 * @param {type} boolean
 * @return:
 */
export const allCarModel = (params) => {
  return fetchGet('supply-api/api/v1/supply/dict/allCarModel', params);
};
/**
 * @description: 所有车长 3.0
 * @param {type} boolean
 * @return:
 */
export const allCarLength = (params) => {
  return fetchGet('supply-api/api/v1/supply/dict/allCarLength', params);
};
/**
 * @description: 发货 3.0
 * @param {type} boolean
 * @return:
 */
export const createGoodsSource = (params) => {
  return fetchPost('supply-api/api/v1/consignor/goodsSource/createGoodsSource', params);
};
/**
 * @description: 修改货源 3.0
 * @param {type} boolean
 * @return:
 */
export const updateGoodsSource = (params) => {
  return fetchPost('supply-api/api/v1/consignor/goodsSource/updateGoodsSource', params);
};
/**
 * @description: 根据id查询货源 3.0
 * @param {type} boolean
 * @return:
 */
export const findBySourceId = (goodsSourceId) => {
  return fetchGet(`supply-api/api/v1/consignor/goodsSource/findBySourceId/${goodsSourceId}`);
};

export const getTruckType = (params) => {
  return fetchGet('supply-api/api/v1/consignor/goodsSource/getTruckType', params);
};
